import React, { FC, useContext } from 'react';
import cls from 'classnames';
import { InBizTableCtx } from '../../context';
import Search from './Search';

interface TableTopProps {
  fetchData?: () => void;
  viewMode?:string;
}

const TableTop: FC<TableTopProps> = ({ fetchData }) => {
  const { search, searchField,viewMode } = useContext(InBizTableCtx);
  return (
    <div>
      <div className={cls('inbiz-table-top')}>
        {/* <Toolbar /> */}
        {search && (searchField || []).length > 0 &&viewMode!='look'&& <Search fetchData={fetchData} />}
      </div>
    </div>
  );
};

export default React.memo(TableTop);
